import { createStore, Store, useStore as useVuexStore } from 'vuex'
import { IRootState, IStoreType } from './types'
import base from './base/base'
import projects from './projects/projects'
import baseconfig from './baseconfig/baseconfig'
import compilers from './compilers/compilers'
import drives from './drives/drives'
import env from './env/env'
import configdef from './configdef/configdef'

const store = createStore<IRootState>({
  state: () => {
    return {}
  },
  mutations: {},
  getters: {},
  actions: {},
  modules: {
    base,
    projects,
    baseconfig,
    compilers,
    drives,
    env,
    configdef
  }
})

export function useStore(): Store<IStoreType> {
  return useVuexStore()
}

export default store
